class CreateTags < ActiveRecord::Migration
  def self.up
    create_table :tags do |t|
      t.column :name, :string, :null => false
      t.column :created_on, :datetime
      t.column :created_by, :integer # user_id of the user who created this tag
      t.column :blog_id, :integer # null if this is a global tag
    end
    
    add_index :tags, [:name, :blog_id], :unique => true
  end

  def self.down
    drop_table :tags
  end
end
